<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="Orbiter is a bootstrap minimal & clean admin template">
    <meta name="keywords" content="chat, chat platform, discussion, video call, voice call, communication, conversation, messange, messanger, talk">
    <meta name="author" content="Themesbox">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
    <title>Orbiter - Bootstrap Minimal & Clean Admin Template</title>
    <!-- Fevicon -->
    <link rel="shortcut icon" href="assets/images/favicon.ico">
    <!-- Start css -->
    <link href="assets/css/bootstrap.min.css" rel="stylesheet" type="text/css">
    <link href="assets/css/icons.css" rel="stylesheet" type="text/css">
    <link href="assets/css/style.css" rel="stylesheet" type="text/css">
    <!-- End css -->
</head>
<body class="vertical-layout">
    <!-- Start Containerbar -->
    <div id="containerbar" class="containerbar authenticate-bg">
        <!-- Start Container -->
        <div class="container">
            <div class="auth-box register-box">
                <!-- Start row -->
                <div class="row no-gutters align-items-center justify-content-center">
                    <!-- Start col -->
                    <div class="col-md-6 col-lg-5">
                        <!-- Start Auth Box -->
                        <div class="auth-box-right">
                            <div class="card">
                                <div class="card-body">
                                    <form action="#" id="mayform">
                                        <div class="form-head">
                                            <a href="index.html" class="logo"><img src="assets/images/logo.svg" class="img-fluid" alt="logo"></a>
                                        </div>
                                        <h4 class="text-primary my-4">注 册</h4>
                                        <div class="form-group">
                                            <input type="text" class="form-control" id="username" name="nickName" placeholder="昵称" required>
                                        </div>
                                        <div class="form-group">
                                            <div class="row">
                                                <div class="col-sm-6">
                                                    <input type="email" class="form-control" id="email" name="email" placeholder="邮箱地址" required>
                                                </div>
                                                <div class="col-sm-4">
                                                    <button type="button" class="btn btn-primary sendcode"  />发送验证码</button>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <input type="text" class="form-control" id="code" name="code" minlength="6"  placeholder="验证码" required>
                                        </div>
                                        <div class="form-group">
                                            <input type="password" class="form-control" id="password"  name="password" minlength="6" placeholder="密码" required>
                                        </div>
                                        <div class="form-row mb-3">
                                            <div class="col-sm-12">
                                                <div class="custom-control custom-checkbox text-left">
                                                    <input type="checkbox" class="custom-control-input" id="terms" name="terms" required>
                                                    <label class="custom-control-label font-14" for="terms">我同意<span style="color: red">秘密电台</span>的条款及条件</label>
                                                </div>
                                            </div>
                                        </div>
                                      <button class="btn btn-success btn-lg btn-block font-18">注册</button>
                                    </form>
                                    <p class="mb-0 mt-3">已经有账号了? <a href="login.html">登录</a></p>
                                </div>
                            </div>
                        </div>
                        <!-- End Auth Box -->
                    </div>
                    <!-- End col -->
                </div>
                <!-- End row -->
            </div>
        </div>
        <!-- End Container -->
    </div>
    <!-- End Containerbar -->
    <!-- Start js -->
    <script src="assets/js/jquery.min.js"></script>
    <script src="assets/js/popper.min.js"></script>
    <script src="assets/js/bootstrap.min.js"></script>
    <script src="assets/js/jquery.validate.min.js"></script>
    <script src="assets/js/messages_cn.js"></script>
    <script src="assets/js/modernizr.min.js"></script>
    <script src="assets/js/detect.js"></script>
    <script src="assets/layer/layer.js"></script>
    <script src="assets/js/jquery.slimscroll.js"></script>
    <script src="cim/httpUtils.js"></script>
    <script src="cim/baseUtils.js"></script>
    <!-- End js -->
    <script type="text/javascript">
        $("#mayform").validate({
            submitHandler:function(items){
                fun_loading(!0)
                var datas = $(items).serializeObject();
                http.post({url:baseUrl+'regist',data:datas},function(err,result){
                    if(result.code == 0){
                        layer.confirm('注册成功，是否跳转登录页面?', {
                            btn: ['确定','取消'], //按钮
                            title:'提示',
                        }, function(){
                            window.location.href = "login.html";
                        }, function(){
                            layer.closeAll(); // 关闭弹窗
                            window.location.reload(); // 刷新页面
                        });
                    }else{
                        layer.msg(result.msg);
                    }
                    fun_loading(!1)
                });
            }
        });
        var timeClock;
        function sendCode() {
            var timer_num = 59;
            $('.sendcode').html(timer_num+"后重新发送");
            timeClock=setInterval(function(){
                timer_num--;
                $('.sendcode').html(timer_num+"后重新发送");
                if (timer_num == 0) {
                    clearInterval(timeClock);
                    $('.sendcode').html("发送验证码");
                    $(".sendcode").attr("disabled",false);
                }
            },1000);
        }
        $(".sendcode").click(function(){
            fun_loading(!0)
            var items = $("#mayform").serializeObject();
            var email = isEmailAvailable(items.email);
            if(!email){
                layer.msg("请输入正确的邮箱！");
                fun_loading(!1)
                return ;
            }
            http.post({url:baseUrl+'content/sendEmail',data:{
                    "toEmail": items.email ,
                    "subject": "木木哒"
                }},function(err,result){
                if(result.code == 0){
                    layer.msg("发送成功,请登录邮箱查看！");
                    $(".sendcode").attr("disabled",true);
                    sendCode();
                }else{
                    layer.msg(result.msg);
                }
                fun_loading(!1)
            });
        });
    </script>
</body>
</html>
